def isorted(ilist, reverse=False):
    tmp = ilist.copy()
    for i in range(len(tmp)):
        for j in range(len(tmp) - i - 1):
            if(tmp[j] < tmp[j + 1]) == reverse:
                tmp[j], tmp[j + 1] = tmp[j + 1], tmp[j]
    return tmp


l1 = [2, 1, 3, 4]
print(l1, isorted(l1))
